package Case_package7;

import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws IOException {

        //服务器：接收浏览器传来的信息，并打印
        //在浏览器中输入网址：10.196.169.101:10000

        //1、创建对象绑定10000端口
        ServerSocket ss = new ServerSocket(10000);

        //2、等待客户端来连接
        Socket socket = ss.accept();

        //3、读取数据
        InputStreamReader isr = new InputStreamReader(socket.getInputStream());
        int b;
        while ((b = isr.read()) != -1) {
            System.out.print((char) b);
        }
        System.out.println();

        //4、释放资源
        socket.close();
        ss.close();

    }
}
